<template>
    <div v-cloak class="aui-wrapper aui-page__iframe">
        <div class="aui-content__wrapper">
            <div class="aui-content">
                <el-card shadow="never" class="aui-card--fill">
                    <div class="mod-lswms__tray">
                        <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
                          <el-form-item>
                            <el-input v-model="dataForm.id" placeholder="id" clearable></el-input>
                          </el-form-item>
                          <el-form-item>
                            <el-button @click="getDataList()">查询</el-button>
                          </el-form-item>
                          <el-form-item>
                            <el-button type="primary" @click="addOrUpdateHandle()">新增</el-button>
                          </el-form-item>
                          <el-form-item>
                            <el-button type="danger" @click="deleteHandle()">删除</el-button>
                          </el-form-item>
                          <el-form-item>
                            <el-button type="info" @click="exportHandle()">导出</el-button>
                          </el-form-item>
                        </el-form>
                        <el-table
                            v-loading="dataListLoading"
                            :data="dataList"
                            border
                            @selection-change="dataListSelectionChangeHandle"
                            @sort-change="dataListSortChangeHandle"
                            style="width: 100%;">
                          <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
                                                    <el-table-column prop="id" label="序号"  header-align="center"
                                           align="center"></el-table-column>
                                                    <el-table-column prop="tray" label="箱号"  header-align="center"
                                           align="center"></el-table-column>
                                                    <el-table-column prop="box" label="格号"  header-align="center"
                                           align="center"></el-table-column>
                                                    <el-table-column prop="weigth" label="重量"  header-align="center"
                                           align="center"></el-table-column>
                                                    <el-table-column prop="status" label="状态"  header-align="center"
                                           align="center"></el-table-column>
                                                    <el-table-column prop="remark" label="备注"  header-align="center"
                                           align="center"></el-table-column>
                                                    <el-table-column prop="adduser" label="新增人"  header-align="center"
                                           align="center"></el-table-column>
                                                    <el-table-column prop="addtime" label="新增时间"  header-align="center"
                                           align="center"></el-table-column>
                                                    <el-table-column prop="updatuser" label="修改人"  header-align="center"
                                           align="center"></el-table-column>
                                                    <el-table-column prop="updatetime" label="修改时间"  header-align="center"
                                           align="center"></el-table-column>
                                                    <el-table-column label='操作' fixed="right" header-align="center" align="center" width="150">
                           <template #default="scope">
                              <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
                              <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
                            </template>
                          </el-table-column>
                        </el-table>
                        <el-pagination
                            :current-page="page"
                            :page-sizes="[10, 20, 50, 100]"
                            :page-size="limit"
                            :total="total"
                            layout="total, sizes, prev, pager, next, jumper"
                            @size-change="pageSizeChangeHandle"
                            @current-change="pageCurrentChangeHandle">
                        </el-pagination>
                        <!-- 弹窗, 新增 / 修改 -->
                        <trayAddOrUpdate v-if="addOrUpdateVisible" ref="addOrUpdate" @refresh-data-list="getDataList"></trayAddOrUpdate>
                    </div>
                </el-card>
            </div>
        </div>
    </div>
</template>

<script>
    import DataList from "@/utils/DataList";
    import {ref , reactive, onMounted ,nextTick} from 'vue' ;
    import trayAddOrUpdate from "@/components/lswms/stock/TrayAddOrUpdate";

	//import {hasPermission} from "@/utils/hasPermission"
    export default {
        name: "tray" ,

        components:{
            trayAddOrUpdate,
        } ,

        setup(){
            const {dataForm,
                mixinViewModuleOptions,
                getDataList,
                dataList,
                total,
                page,
                limit,
                dataListLoading,
                dataListSelectionChangeHandle,
                dataListSortChangeHandle,
                pageSizeChangeHandle,
                pageCurrentChangeHandle,
                addOrUpdateHandle,
                deleteHandle,
                exportHandle,
                addOrUpdateVisible,
                dataListSelections,
                addOrUpdate}  = DataList();

            onMounted(()=>{
				mixinViewModuleOptions.value.getDataListIsPage = true;
                mixinViewModuleOptions.value.getDataListURL = '/lswms/tray/page' ;
                mixinViewModuleOptions.value.deleteURL = '/lswms/tray' ;
                mixinViewModuleOptions.value.exportURL= '/lswms/tray/export';
				mixinViewModuleOptions.value.deleteIsBatchKey= 'id';
				mixinViewModuleOptions.value.deleteIsBatch = true
                if (mixinViewModuleOptions.value.activatedIsNeed) {
                    getDataList();
                }

            })

            return {
                dataForm,
                mixinViewModuleOptions,
                getDataList,
                dataList,
                total,
                page,
                limit,
                dataListLoading,
                dataListSelectionChangeHandle,
                dataListSortChangeHandle,
                pageSizeChangeHandle,
                pageCurrentChangeHandle,
                addOrUpdateHandle,
                deleteHandle,
                exportHandle,
                addOrUpdateVisible,
                dataListSelections,
                addOrUpdate,
            }
        },
		// methods:{
		// 	hasPermission
		// }
    }
</script>

<style scoped>

</style>
